<template>
  <div class="app-container">
    <div class="container ">
      <el-row :gutter="10" class="filter-container">
        <el-col :span="15">
          <el-button
            v-if="isManage"
            v-waves
            class="filter-item margin-left20"
            type="primary"
            size="mini"
            @click="submitForm('open')"
          >
            <i class="el-icon-circle-plus-outline" />&nbsp;新增
          </el-button>
          <el-upload
            v-if="isManage"
            class="upload-demo"
            :show-file-list="false"
            action="http://10.10.10.11:9006/file/upload"
            :before-upload="beforeAvatarUpload"
            :headers="upHeaders"
            accept=".xls,.xlsx"
            :on-success="handleAvatarSuccess"
          >
            <el-button
              v-if="isManage"
              size="mini"
              class="filter-item margin-left20"
              type="primary"
            ><i class="el-icon-circle-plus-outline" />&nbsp;导入</el-button>
          </el-upload>
          <el-button
            v-if="isManage"
            v-waves
            class="filter-item margin-left20 upload-demo"
            type="primary"
            size="mini"
            @click="outloadFile"
          >
            <i class="el-icon-download" />&nbsp;导出
          </el-button>
          <el-button
            v-if="isManage"
            v-waves
            class="filter-item margin-left20 upload-demo"
            type="primary"
            size="mini"
            @click="downloadFile"
          >
            下载导入模板
          </el-button>
        </el-col>
        <!-- <el-col :span="4" style="text-align: right;">
          <el-select
            v-model="listQuery.departId"
            placeholder="请选择部门"
            size="mini"
            clearable
            @change="queryDepartC"
          >
            <el-option
              v-for="item in options3"
              :key="item.id"
              :label="item.name"
              :value="item.id"
            />
          </el-select>
        </el-col> -->
        <el-col :span="9" style="text-align: right;">
<!--          v-if="isManage"-->
<!--          :disabled="disableSelectDept"-->
          <el-select
            v-show="!disableSelectDept"
            v-model="listQuery.departId"
            style="width:130px;padding-right:12px"
            placeholder="全部部门"
            size="mini"
            clearable
            @change="queryDepartC"
          >
            <el-option
              v-for="item in options3"
              :key="item.id"
              :label="item.name"
              :value="item.id"
            />
          </el-select>
          <el-input
            v-if="isManage"
            v-model="listQuery.search"
            style="width:130px;padding-right:12px"
            :placeholder="placeholderName"
            size="mini"
          />
          <el-button
            v-if="isManage" size="mini" type="primary" @click="getList">
            搜索
          </el-button>
        </el-col>
      </el-row>
      <div>
        <!-- 删除资产 -->
        <el-dialog
          title="删除资产"
          :visible.sync="delUserdialogV"
          width="25%"
          center
        >
          <div class="text-algin-center">
            <el-avatar :size="60" src="../../assets/icons_slices/img_opo_tip.png">
              <img src="../../assets/icons_slices/img_opo_tip.png">
            </el-avatar>
            <h3>确定删除吗？</h3>
            <span>删除后不可恢复</span>
          </div>
          <span slot="footer" class="dialog-footer">
            <el-button type="danger" size="mini" @click="delUserdialogV = false">删除</el-button>
            <el-button size="mini" @click="delUserdialogV = false">取 消</el-button>
          </span>
        </el-dialog>
        <!-- 回收资产 -->
        <el-dialog
          title="删除资产"
          :visible.sync="recUserdialogV"
          width="25%"
          center
        >
          <div class="text-algin-center">
            <el-avatar :size="60" src="../../assets/icons_slices/img_opo_tip.png">
              <img src="../../assets/icons_slices/img_opo_tip.png">
            </el-avatar>
            <h3>确定删除吗？</h3>
            <!-- <span>回收后已授权软件将不用</span> -->
          </div>
          <span slot="footer" class="dialog-footer">
            <el-button type="danger" size="mini" @click="handleRecover('do')">删除</el-button>
            <el-button size="mini" @click="recUserdialogV = false">取 消</el-button>
          </span>
        </el-dialog>
      </div>
      <el-table
        v-loading="listLoading"
        element-loading-text="正在加载中..."
        element-loading-background="rgba(0, 0, 0, 0.5)"
        :data="list"
        type="index"
        border
        size="mini"
        fit
        :span-method="objectSpanMethod"
        highlight-current-row
      >
        <el-table-column align="center" label="序号">
          <template slot-scope="scope">
            {{ scope.$index+1 + ((listQuery.page-1) * listQuery.limit ) }}
          </template>
        </el-table-column>
        <el-table-column label="软件编号" align="center" width="200px">
          <template slot-scope="scope">
            {{ scope.row.softNumber }}
          </template>
        </el-table-column>
        <el-table-column label="软件名称" align="center" width="200px">
          <template slot-scope="scope">
            {{ scope.row.softName }}
          </template>
        </el-table-column>
        <el-table-column label="软件版本" align="center" width="220px">
          <template slot-scope="scope">
            <div class="strinExceeds" :title="scope.row.softVersion">{{ scope.row.softVersion }}</div>
          </template>
        </el-table-column>
        <el-table-column label="部门" align="center" width="200px">
          <template slot-scope="scope">
            {{ scope.row.deptName }}
          </template>
        </el-table-column>
        <el-table-column label="姓名" align="center" width="120px">
          <template slot-scope="scope">
            {{ scope.row.userName }}
          </template>
        </el-table-column>
        <el-table-column align="center" label="计算机编号" width="140px">
          <template slot-scope="scope">
            {{ scope.row.deviceNumber }}
          </template>
        </el-table-column>
        <el-table-column align="center" label="计算机品牌" width="120px">
          <template slot-scope="scope">
            {{ scope.row.brandName }}
          </template>
        </el-table-column>
        <el-table-column label="计算机类型" align="center" width="120px">
          <template slot-scope="scope">
            {{ scope.row.deviceType }}
          </template>
        </el-table-column>
        <el-table-column label="所在网络" align="center" width="100px">
          <template slot-scope="scope">
            {{ scope.row.networkType ==1 ? '内网' : '外网' }}
          </template>
        </el-table-column>
        <el-table-column label="是否国产" align="center" width="100px">
          <template slot-scope="scope">
            {{ scope.row.softFrom ==1 ? '是' : '否' }}
          </template>
        </el-table-column>
        <el-table-column label="授权方式" align="center" width="100px">
          <template slot-scope="scope">
            {{ scope.row.permitMode == 1?'永久':'年度' }}
          </template>
        </el-table-column>
        <el-table-column label="许可期限" align="center" width="120px">
          <template slot-scope="scope">
            {{ scope.row.permitEndDate }}
          </template>
        </el-table-column>
        <el-table-column label="软件类型" align="center" width="120px">
          <template slot-scope="scope">
            {{ scope.row.softTypeName }}
          </template>
        </el-table-column>
        <el-table-column label="安装日期" align="center" width="200px">
          <template slot-scope="scope">
            {{ scope.row.installDate }}
          </template>
        </el-table-column>
        <el-table-column label="卸载日期" align="center" width="200px">
          <template slot-scope="scope">
            {{ scope.row.uninstallDate }}
          </template>
        </el-table-column>
        <!-- <el-table-column label="备注" align="center" width="200px">
          <template slot-scope="scope">
            {{ scope.row.remark }}
          </template>
        </el-table-column> -->
        <el-table-column
          v-if="isManage"
          label="操作"
          width="180"
          align="left"
          fixed="right"
        >
          <template slot-scope="scope">
            <el-button
              style="width: 70px;"
              type="primary"
              size="mini"
              @click="handleEdit(scope.$index, scope.row)"
            >编辑</el-button>
            <el-button style="width: 70px;"
              v-if="isManage"
              type="danger"
              size="mini"
              @click="handleRecover(scope.$index, scope.row)"
            >删除</el-button>
            <!-- <el-button
              type="danger"
              size="mini"
              @click="handleDelete(scope.$index, scope.row)"
            >删除</el-button> -->
          </template>
        </el-table-column>
      </el-table>
      <pagination :total="total" :page.sync="listQuery.page" :limit.sync="listQuery.limit" @pagination="getList" />
      <p>注：1.计算机编号：按照单位固定资产登记的编号填写。</p>
      <p class="margin-left30">2.计算机品牌：填写生产计算机的厂商名称，如：长城、清华同方。</p>
      <p class="margin-left30">3.计算机类型：指台式机、笔记本、实体服务器、虚拟服务器；</p>
      <p class="margin-left30">4.软件名称：采用《水利固定资产分类与代码》（SL 731—2015）中水利固定资产代码表中“名称”，</p>
      <p class="margin-left30">如：（1）WPS office2019 ，软件名称应为：办公软件；（2）windows 7，软件名称应为：操作系统。</p>
      <p class="margin-left30">5.软件版本：填写具体版本，如：WPS office 2019专业版。</p>
      <p class="margin-left30">6.授权方式：为永久授权、年度授权、无授权。</p>
      <p class="margin-left30">7.软件类型：指商业软件、OEM软件、自开发软件。</p>
    </div>
    <!-- 添加用户弹框 -->
    <el-dialog
      :title="titleStatus"
      :visible.sync="addUserdialogV"
      width="80%"
      :before-close="handleClose"
      center
    >
      <el-form
        ref="ruleForm"
        class="formInner"
        :rules="rules"
        label-width="130px"
        size="mini"
        :inline="true"
        :model="formAddUser"
      >
        <el-row>
          <el-col :span="8">
            <el-form-item label="部门:" prop="deptId">
              <el-select  v-model="formAddUser.deptId" placeholder="请选择">
                <el-option
                  v-for="item in options3"
                  :key="item.id"
                  :label="item.name"
                  :value="item.id"
                />
              </el-select>
            </el-form-item>
          </el-col>
          <el-col :span="8">
            <el-form-item label="姓名:" prop="userName">
              <el-input v-model="formAddUser.userName" />
            </el-form-item>
          </el-col>
          <el-col :span="8">
            <el-form-item label="计算机编号:" prop="deviceNumber">
              <el-input v-model="formAddUser.deviceNumber" />
            </el-form-item>
          </el-col>
        </el-row>
        <el-row>
          <el-col :span="8">
            <el-form-item label="计算机品牌:" prop="brandName">
              <el-input v-model="formAddUser.brandName" />
            </el-form-item>
          </el-col>
          <el-col :span="8">
            <el-form-item label="计算机类型:" prop="deviceType">
              <el-select v-model="formAddUser.deviceType" placeholder="请选择">
                <el-option
                  v-for="item in options2"
                  :key="item.value"
                  :label="item.label"
                  :value="item.value"
                />
              </el-select>
            </el-form-item>
          </el-col>
          <el-col :span="8">
            <el-form-item label="软件编号:" prop="softNumber">
              <el-input v-model="formAddUser.softNumber" />
            </el-form-item>
          </el-col>
        </el-row>
        <el-row>
          <el-col :span="8">
            <el-form-item label="软件名称:" prop="softName">
              <el-input v-model="formAddUser.softName" />
            </el-form-item>
          </el-col>
          <el-col :span="8">
            <el-form-item label="软件版本:" prop="softVersion">
              <el-input v-model="formAddUser.softVersion" />
            </el-form-item>
          </el-col>
          <el-col :span="8">
            <el-form-item label="授权方式:" prop="permitMode">
              <el-select
                v-model="formAddUser.permitMode"
                placeholder="请选择"
                @change="permitModeC"
              >
                <el-option
                  v-for="item in options1"
                  :key="item.value"
                  :label="item.label"
                  :value="item.value"
                />
              </el-select>
            </el-form-item>
          </el-col>
        </el-row>
        <el-row>
          <el-col v-if="formAddUser.permitMode !== 1" :span="8">
            <el-form-item label="许可期限:">
              <div class="block">
                <el-date-picker
                  v-model="formAddUser.permitEndDate"
                  :disabled="formAddUser.softType == '60660672704221184'? true : false"
                  style="width:85%"
                  type="date"
                  title="请选择许可截止期限"
                  value-format="yyyy-MM-dd"
                  placeholder="选择日期"
                />
              </div>
            </el-form-item>
          </el-col>
          <el-col v-if="formAddUser.permitMode == 1" :span="8">
            <el-form-item label="许可期限:">
              <el-input
                v-model="formAddUser.permitEndDate"
                value-format="yyyy-MM-dd"
                :disabled="(formAddUser.softType == '60660672704221184' || formAddUser.permitMode == '1')? true : false"
              />
            </el-form-item>
          </el-col>
          <el-col :span="8">
            <el-form-item label="安装日期:">
              <div class="block">
                <el-date-picker
                  v-model="formAddUser.installDate"
                  style="width:85%"
                  type="date"
                  value-format="yyyy-MM-dd"
                  placeholder="选择日期"
                />
              </div>
            </el-form-item>
          </el-col>
          <el-col :span="8">
            <el-form-item label="卸载日期:">
              <div class="block">
                <el-date-picker
                  v-model="formAddUser.uninstallDate"
                  style="width:85%"
                  type="date"
                  value-format="yyyy-MM-dd"
                  placeholder="选择日期"
                />
              </div>
            </el-form-item>
          </el-col>
          </el-col></el-row>
        <el-row>
          <el-col :span="8">
            <el-form-item label="软件类型:" prop="softType">
              <el-select
                v-model="formAddUser.softType"
                placeholder="请选择"
                @change="PurchAmountC"
              >
                <el-option
                  v-for="item in options"
                  :key="item.id"
                  :label="item.name"
                  :value="item.id"
                />
              </el-select>
            </el-form-item>
          </el-col>
          <el-col :span="8">
            <el-form-item label="所在网络:" prop="networkType">
              <el-select v-model="formAddUser.networkType" placeholder="请选择">
                <el-option
                  v-for="item in options5"
                  :key="item.value"
                  :label="item.label"
                  :value="item.value"
                />
              </el-select>
            </el-form-item>
          </el-col>
          <el-col :span="8">
            <el-form-item label="是否国产:" prop="softFrom">
              <el-select v-model="formAddUser.softFrom" placeholder="请选择">
                <el-option
                  v-for="item in options4"
                  :key="item.value"
                  :label="item.label"
                  :value="item.value"
                />
              </el-select>
            </el-form-item>
          </el-col>
        </el-row>
      </el-form>
      <span slot="footer" class="dialog-footer">
        <el-button type="primary" size="mini" @click="submitForm('ruleForm')">确 定</el-button>
        <el-button size="mini" @click="handleClose">取 消</el-button>
      </span>
    </el-dialog>

  </div>
</template>

<script>
import { getToken } from '@/utils/auth'
import Pagination from '@/components/Pagination'
import {
  departmentList
} from '@/api/department'
import { assetUserPage, assetUserAdd, assetUserDel,
  assetUserPut, assetsImport, assetsExport } from '@/api/assetUserSoft'
import { softTypeList } from '@/api/softManage'
import { userList, userAdd
  , userDel, userPut, userPermission, userPasswordPut } from '@/api/user'
import { getCookie, setCookie, removeCookie } from '@/utils/cookie'
export default {
  components: { Pagination },
  filters: {
    statusFilter(status) {
      const statusMap = {
        published: 'success',
        draft: 'gray',
        deleted: 'danger'
      }
      return statusMap[status]
    }
  },
  data() {
    return {
      upHeaders: {
        ACCESS_TOKEN: getToken()
      },
      recUserdialogV: false,
      datevalue2: null,
      datevalue1: null,
      isUserEdit: false,
      titleStatus: '添加',
      rules: {
        deptId: [
          { required: true, message: '请选择', trigger: 'blur' }
        ],
        softFrom: [
          { required: true, message: '请选择', trigger: 'blur' }
        ],
        networkType: [
          { required: true, message: '请选择', trigger: 'blur' }
        ],
        permitMode: [
          { required: true, message: '请选择', trigger: 'blur' }
        ],
        softType: [
          { required: true, message: '请选择', trigger: 'blur' }
        ],
        softVersion: [
          { required: true, message: '请输入内容', trigger: 'blur' }
        ],
        softName: [
          { required: true, message: '请输入内容', trigger: 'blur' }
        ],
        softNumber: [
          { required: true, message: '请输入内容', trigger: 'blur' }
        ],
        deviceType: [
          { required: true, message: '请选择', trigger: 'blur' }
        ],
        brandName: [
          { required: true, message: '请输入内容', trigger: 'blur' }
        ],
        softNumber: [
          { required: true, message: '请输入内容', trigger: 'blur' }
        ],
        deviceNumber: [
          { required: true, message: '请输入内容', trigger: 'blur' }
        ],
        userName: [
          { required: true, message: '请输入内容', trigger: 'blur' }
        ],
        phone: [
          { required: true, message: '请输入手机号', trigger: 'blur' },
          { min: 11, max: 11, message: '手机号长度不对', trigger: 'blur' }
        ],
        password: [
          { required: true, message: '请输入内容', trigger: 'blur' },
          { min: 2, max: 25, message: '长度在 6 到 25 个字符', trigger: 'blur' }
        ]
      },
      formAddUser: {
        'brandName': '',
        'companyName': '',
        'createTime': '',
        'deptId': '',
        'deptName': '',
        'deviceNumber': '',
        'deviceType': '',
        'fillFormName': '',
        'fillFormPhone': '',
        'id': '',
        'installDate': '',
        'permitEndDate': '永久',
        'permitMode': 1,
        'remark': '',
        'softName': '',
        'softNumber': '',
        'softType': '',
        'softTypeName': '',
        'softVersion': '',
        'sortNum': 0,
        'uninstallDate': '',
        'updateTime': '',
        'userId': '',
        'userName': '',
        'year': ''
      },
      addUserdialogV: false,
      delUserdialogV: false,
      value1: '1',
      value2: '1',
      total: 10,
      list: [],
      listLoading: false,
      disableSelectDept: false, // 是否可选择部门
      listQuery: {
        departId: '',
        search: '',
        page: 1,
        limit: 10,
        menuFrom: 1
      },
      options: [{
        value: '1',
        label: '商业软件'
      }, {
        value: '2',
        label: 'OEM软件'
      }, {
        value: '3',
        label: '自开发软件'
      }],
      options1: [{
        value: 1,
        label: '永久授权'
      }, {
        value: 2,
        label: '年度授权'
      }],
      options2: [{
        value: '1',
        label: '一体机'
      }, {
        value: '2',
        label: '笔记本'
      }, {
        value: '3',
        label: '台式机'
      }, {
        value: '4',
        label: '服务器'
      }],
      options3: [{
        value: '1',
        label: '综合管理部'
      }, {
        value: '2',
        label: '总调度中心'
      }, {
        value: '3',
        label: '计划合同部'
      }],
      options5: [{
        value: 1,
        label: '内网'
      }, {
        value: 2,
        label: '外网'
      }],
      options4: [{
        value: 1,
        label: '是'
      }, {
        value: 2,
        label: '否'
      }],
      editPassword: false,
      value: '1',
      cacheId: null,
      placeholderName: '所有人'
    }
  },
  computed: {
    isManage() {
      // console.log(getCookie('userInfo').realName)
      if (getCookie('userInfo')) {
        return JSON.parse(getCookie('userInfo')).roleType === 1024 ||
        JSON.parse(getCookie('userInfo')).roleType === 1025
      } else {
        return false
      }
    }
  },
  created() {
    this.getDepartmentList()
    this.fetchData()
    this.getTypeList()
  },
  methods: {
    queryDepartC(val) {
      if (val) {
        this.placeholderName = '所有人'
      } else {
        this.placeholderName = '所有人'
      }
      // this.getList()
    },
    PurchAmountC(val) {
      if (val == '60660672704221184') {
        this.formAddUser.permitEndDate = ''
      }
    },
    permitModeC(val) {
      if (val == 1) {
        this.formAddUser.permitEndDate = '永久'
      } else {
        this.formAddUser.permitEndDate = ''
      }
    },
    getTypeList() {
      softTypeList({
        limit: 20,
        page: 1
      }).then(res => {
        if (res.code === 200) {
          this.options = []
          res.data.data.map(item => {
            if (item.id !== '1025' && item.id !== '55904214559285248') {
              this.options.push(item)
            }
          })
        }
      })
    },
    getDepartmentList() {
      console.log('部门信息加载')
      departmentList({
        limit: 50,
        page: 1
      }).then(res => {
        if (res.code === 200) {
          this.options3 = []
          res.data.data.map(item => {
            if (item.id !== '1025' && item.id !== '55904214559285248') {
              this.options3.push(item)
            }
          })
          console.log('this.options3:',this.options3)
          if (this.options3.length === 1) {
            this.formAddUser.deptId = this.options3[0].id
            this.listQuery.departId = this.options3[0].id
            console.log('formAddUser.deptId:',this.formAddUser.deptId)

            this.disableSelectDept = true
          } else {
            this.disableSelectDept = false
          }
        }
      })
    },
    downloadFile() {
      const link = document.createElement('a')
      link.style.display = 'none'
      link.setAttribute('download', '正版软件使用台账-模板')
      link.href = 'http://10.10.10.11:9006/upload/%E6%A8%A1%E6%9D%BF-%E8%BD%AF%E4%BB%B6%E4%BD%BF%E7%94%A8%E5%8F%B0%E8%B4%A6.xlsx'
      document.body.appendChild(link)
      link.click()
    },
    outloadFile() {
      assetsExport(this.listQuery).then(res => {
        if (res.code === 200) {
          // this.getList()
          const link = document.createElement('a')
          link.style.display = 'none'
          link.setAttribute('download', '信息化固定资产管理台帐')
          link.href = res.message
          document.body.appendChild(link)
          link.click()
          // window.open(res.message)
        }
      })
    },
    beforeAvatarUpload(file) {
      const isJPG = file.name.indexOf('xls')
      const isLt2M = file.size / 1024 / 1024 < 200
      console.log("上传文件信息:",file)
      if (!isJPG) {
        this.$message.error('上传文件只能是Excel文件!')
      }
      if (!isLt2M) {
        this.$message.error('上传文件大小不能超过 200MB!')
      }
      return isJPG && isLt2M
    },
    handleAvatarSuccess(response, file, fileList) {
      if (response && response.code === 200) {
        this.listLoading = true
        assetsImport({
          filePath: response.data
        }).then(res => {
          if (res.code === 200) {
            // this.getList()
            this.listLoading = false
            this.$message.success('导入使用台账申请成功')
          }
        })
        // this.ruleForm.logo = response.data
        // this.logoUrl = URL.createObjectURL(file.raw)
      } else {
        this.$message.warning('请求异常')
      }
    },
    objectSpanMethod({ row, column, rowIndex, columnIndex }) {
      // if (columnIndex === 1 || columnIndex === 2) {
      //   if (rowIndex % 2 === 0) {
      //     return {
      //       rowspan: 2,
      //       colspan: 1
      //     }
      //   } else {
      //     return {
      //       rowspan: 0,
      //       colspan: 0
      //     }
      //   }
      // }
    },
    initData() {
      if (this.$refs.ruleForm) {
        this.$refs.ruleForm.clearValidate()
      }
      this.formAddUser = {
        'brandName': '',
        'companyName': '',
        'createTime': '',
        'deptId': '',
        'deptName': '',
        'deviceNumber': '',
        'deviceType': '',
        'fillFormName': '',
        'fillFormPhone': '',
        'id': '',
        'installDate': '',
        'permitEndDate': '永久',
        'permitMode': 1,
        'remark': '',
        'softName': '',
        'softNumber': '',
        'softType': '',
        'softTypeName': '',
        'softVersion': '',
        'sortNum': 0,
        'uninstallDate': '',
        'updateTime': '',
        'userId': '',
        'userName': '',
        'year': ''
      }
      if (this.options3.length === 1) {
        this.formAddUser.deptId = this.options3[0].id
        this.listQuery.departId = this.options3[0].id
        this.disableSelectDept = true
      } else {
        this.disableSelectDept = false
      }
    },
    handleClose(params) {
      this.initData()
      this.getList()
      this.addUserdialogV = false
    },
    submitForm(formName, editPassword) {
      if (formName === 'open') {
        this.initData()
        this.titleStatus = '添加'
        this.formAddUser.userName = ''
        this.formAddUser.phone = ''
        this.addUserdialogV = true
        this.formAddUser.id = ''
        this.isUserEdit = false
      } else {
        if (this.formAddUser.id !== '') {
          this.$refs['ruleForm'].validate((valid) => {
            if (valid) {
              assetUserPut(this.formAddUser).then(res => {
                if (res.code === 200) {
                  this.imageUrl = ''
                  this.addUserdialogV = false
                  this.initData()
                  this.getList()
                }
              })
            }
          })
        } else {
          this.$refs[formName].validate((valid) => {
            if (valid) {
              assetUserAdd(this.formAddUser).then(res => {
                if (res.code === 200) {
                  this.addUserdialogV = false
                  this.initData()
                  this.getList()
                }
              })
              // alert('submit!')
            } else {
              return false
            }
          })
        }
      }
    },
    resetForm(formName) {
      this.$refs[formName].resetFields()
    },
    handleEdit(index, row) {
      this.titleStatus = '修改'
      this.addUserdialogV = true
      this.formAddUser = row
    },
    handleRecover(index, row) {
      if (index == 'do') {
        // this.$confirm('确定删除吗？', {
        //   confirmButtonText: '确定',
        //   cancelButtonText: '取消',
        //   type: 'warning'
        // }).then(() => {
        assetUserDel(
          {
            ids: this.cacheId
          }
        ).then(res => {
          if (res.code == 200) {
            this.recUserdialogV = false
            this.$message.success('删除成功')
            this.getList()
          }
        })
        // }).catch(() => {
        //   this.$message.info('已点击取消')
        // })
      } else {
        this.recUserdialogV = true
        this.cacheId = row.id
      }
    },
    handleDelete(index, row) {
      this.delUserdialogV = true
    },
    getList() {
      this.listLoading = true
      assetUserPage(this.listQuery).then(response => {
        this.list = response.data.data
        this.total = response.totalCount
        this.listLoading = false
      })
    },
    fetchData() {
      this.getList()
    }
  }
}
</script>
<style>
  .filter-container{
    margin-bottom: 20px;
  }
</style>
<style scoped>
  /deep/.formInner {
     .el-select>.el-input {
      width: 166px;
    }
  }
  .upload-demo{
    display: inline;
    margin-left: 10px;
  }
    .margin-left30 {
        margin-left: 30px;
      font-size: .8rem;
    }
  .text-algin-center {
    text-align: center;
  }
  .container {
    padding: 25px 20px 20px 20px !important;
  }
</style>
